var nowDate = getDay(0);
var resdata;
var url;
var trStr="";
$(document).ready(function(){
	$('#name').text(sessionStorage.getItem("name"));
	window.addEventListener('pageshow', function(e) {
    if (e.persisted) {
        window.location.reload();
    }else{
	$.ajax({
		url: "../../yaohuo/getmendian_hc"
		,type:'post'
		,data:JSON.stringify({"type":0})
		,contentType: "application/json; charset=utf-8"
		,dataType:'json'
		,success: function(res){
			console.log(res.data);
			trStr="";
			if(res.data.length>0){
				for (var i = 0; i < res.data.length; i++) {
				
					trStr +='<p onclick="pdstart(\''+res.data[i].StoreNO+'\',\''+res.data[i].StoreName+'\',\''+res.data[i].Statue+'\')">'+res.data[i].StoreNO+'.'+res.data[i].StoreName+'</p>'
						
					}
				$('#wpdDiv').append(trStr);
			}
		}
	});
	$.ajax({
		url: "../../yaohuo/getmendian_hc"
		,type:'post'
		,data:JSON.stringify({"type":1})
		,contentType: "application/json; charset=utf-8"
		,dataType:'json'
		,success: function(res){
			trStr="";
			console.log(res.data);
				if(res.data.length>0){
				for (var i = 0; i < res.data.length; i++) {trStr +='<p style="color:orange" onclick="pdfinish(\''+res.data[i].PaperNO+'\',\''+res.data[i].StoreNO+'\',\''+res.data[i].StoreName+'\',\''+res.data[i].Statue+'\')">'+res.data[i].StoreNO+'.'+res.data[i].StoreName+'('+res.data[i].Statue+')'+'</p>'}
				$('#ypdDiv').append(trStr);
			}
		}
	});
	}
	});
});
function pdstart(StoreNO,StoreName,Statue){
	StoreName =encodeURI(encodeURI(StoreName));
	Statue =encodeURI(encodeURI(Statue));
	url = "mendian_hc?StoreNO="+StoreNO+"&StoreName="+StoreName+"&Statue="+Statue;//此处拼接内容
	window.location.href = url;
}
function pdfinish(PaperNO,StoreNO,StoreName,Statue){
	if(Statue=="已完成"){
		StoreName =encodeURI(encodeURI(StoreName));
		Statue =encodeURI(encodeURI(Statue));
		url = "paperno2_hc?PaperNO="+PaperNO+"&StoreNO="+StoreNO+"&StoreName="+StoreName+"&Statue="+Statue;//此处拼接内容
	}else{
		StoreName =encodeURI(encodeURI(StoreName));
		Statue =encodeURI(encodeURI(Statue));
		url = "paperno_hc?PaperNO="+PaperNO+"&StoreNO="+StoreNO+"&StoreName="+StoreName+"&Statue="+Statue;//此处拼接内容
	}
	window.location.href = url;
}